package com.bckj.fastboot.paid.biz.infrastructure.sdk;

public abstract class PayServiceWrapper {

    protected String appId;
    private PayConfigWrapper payConfigWrapper;

    protected volatile Object service;

    public PayServiceWrapper(String appId) {
        this.appId = appId;
    }

    protected abstract void init();

    protected void refresh() {

    }

    public void setPayConfigWrapper(PayConfigWrapper payConfigWrapper) {
        this.payConfigWrapper = payConfigWrapper;
    }

    public PayConfigWrapper getPayConfigWrapper() {
        return payConfigWrapper;
    }

    public Object getService() {
        if (service == null) {
            synchronized (this) {
                if (service == null) {
                    init();
                }
            }
        }
        return service;
    }
}
